const Router = require('@koa/router');

const { auth } = require('@middleware/auth.middleware');

const { changePageType } = require('@middleware/tools.middleware');

const { validator, validatorByUpdate } = require('./address.middleware');

const { add, update, setDefault, list } = require('./address.controller');

const router = new Router({ prefix: '/address' });

router.use(auth);

router.post('/add', validator, add);

router.post('/update', validatorByUpdate, update);

router.post('/setDefault', setDefault);

router.get('/list', changePageType, list);

module.exports = router;
